//
//  YFConstant.h
//  BagerKit
//
//  Created by Bager on 2017/8/24.
//  Copyright © 2017年 Bager. All rights reserved.
//

#ifndef YFMacro_h
#define YFMacro_h

#if TARGET_IPHONE_SIMULATOR//模拟器
#define PHONE_MARK  0
#elif TARGET_OS_IPHONE//真机
#define PHONE_MARK 1

#endif

// Block
typedef void (^ CallBack)(id result);
typedef void (^ NoParamBlock)(void);

// 16进制颜色转换
#define HexColor(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

// 尺寸
#define kScreenWidth   [[UIScreen mainScreen] bounds].size.width
#define kScreenHeight  [[UIScreen mainScreen] bounds].size.height
#define kPublicNavHeight 64
#define kPublicMargin    15
#define kPublicPadding   10

// 字体
#define kAppDefaultFont   [UIFont systemFontOfSize:14]
#define kAppDefaultFont12 [UIFont systemFontOfSize:12]
#define kAppDefaultFont16 [UIFont systemFontOfSize:16]
#define kAppDefaultFont18 [UIFont systemFontOfSize:18]

// 颜色
#define random(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0]
#define randomColor random(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
#define kPublicColorMain HexColor(0x02bef7)
#define kPublicColorDarkGray HexColor(0xCAC7C7)
#define kPublicColorGray HexColor(0xA2A2A2)
#define kPublicColorLightGray HexColor(0xEEEEF4)
#define kPublicColorRed HexColor(0xFe5757)
#define kPublicColorOrange HexColor(0xff562e)
#define kPublicColorBlue HexColor(0x5e8bf1)

//转化为weak对象（block循环引用使用时）
#define DefineWeakSelf __weak __typeof(self) weakSelf = self
#define DefineStrongSelf __strong __typeof(self) strongSelf = self

#ifdef DEBUG
#define YFLog(format, ...) NSLog((@"%s [Line %d] " format), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define YFLog(...)
#endif

#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
#define NSLog(...)
#define debugMethod()
#endif

#endif /* YFConstant_h */
